﻿using ReactiveUI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _02_WimForms_Bindings
{
    public class MainViewModel : ReactiveObject
    {
        //标题
        private string _applicationTitle;
        //日期栏:单向绑定
        private string _valueOne;
        //编辑框:双向绑定
        private long _valueTwo;

        /// <summary>
        /// 标题
        /// </summary>
        public string ApplicationTitle
        { 
            get => _applicationTitle;
            set => this.RaiseAndSetIfChanged(ref _applicationTitle, value); 
        }
        /// <summary>
        /// textbox与Label单向绑定
        /// </summary>
        public string ValueOne
        { 
            get => _valueOne; 
            set => this.RaiseAndSetIfChanged(ref _valueOne, value); 
        }
        /// <summary>
        /// datetime与label进行绑定
        /// </summary>
        public long ValueTwo 
        { 
            get => _valueTwo; 
            set => this.RaiseAndSetIfChanged(ref _valueTwo, value);
        }

        /// <summary>
        /// 构造函数初始化
        /// </summary>
        public MainViewModel()
        {
            //设置值
            ApplicationTitle = "BIndings 方法测试";
            //设置值
            ValueOne = "单向绑定";
            //双向绑定设置日志
            ValueTwo = DateTime.Now.Date.ToFileTime();
        }

    }
}
